home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
misc
/
unix
/
Scroller.Z
/
Scroller
Wrap
Text File
|
1995-04-19
|
9KB
|
204 lines
#!/bin/sh
# Run the following text with /bin/sh
# Created: 7 Apr 95 (c) Pawel Hernik <spi-ph@srv1.tu.kielce.pl>
echo "Writing scroll.readme ..."
cat <<\_EOF >scroll.readme
DESCRIPTION:
This is simple scroller for terminals supporting ansi sequences written
in ansi C under Unix (SunOS) but should work on all systems (even Amiga).
INSTALLATION:
To install type "gzip -d Scroller" and then "sh Scroller"
(or "chmod 700 Scroller" and "Scroller"). Installer automaticaly writes
doc, source in current directory and compiles it.
On Amiga you have to manually cut out source and simply type
"execute scroller.c" for compiling with SAS C.
USAGE:
scroll [-x<xn>][-y<yn>][-w<wd>][-l<lp>][-d<del>] textfile
x,y - upper left corner of scroller (1,1)
w - scroller width (77)
l - loop counter (1)
d - delay (0)
Type for example:
scroll -y18 -w80 -l2 text
Minimal value for x,y,w is 1. Maximal value for width is 200 (if you have
such wide terminal or use window under XWindows). Height of scroller is
constant (6 chars). If your terminal is too fast use delay option.
Without any arguments scroller displays all possible characters.
AUTHOR:
If you like and use it send to me a postcard or e-mail.
This program is of course FREEWARE :) but you still CAN send to me
1GB hard disk, 040 or 060 card for my A4030, digital multisync monitor, etc.
Pawel Hernik
Nowowiejska 24/3
25532 Kielce
POLAND
E-mail: spi-ph@srv1.tu.kielce.pl
_EOF
echo "Writing scroll.c ..."
cat <<\_EOF >scroll.c
;/*
sc scroll.c
slink from lib:c.o scroll.o to scroll lib lib:sc.lib
quit
*/
/*
* (C)1995 Pawel Hernik <spi-ph@srv1.tu.kielce.pl>
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
FILE *fil;
char namef[80]="";
int wd=77,lp=1,x=1,y=1,del=0;
int lets,lete,spc,i;
char t1[200],t2[200],t3[200],t4[200],t5[200],t6[200];
long k,scrlen=0;
char *scrtxt,*scrtxt2;
char *fnt1="__________ ___________ _________ __________ ____________ ____________ _________ ______ __ ____ ____ ______ ___________ ______ __ ______ __ ______ ___________ ______ ___________ __________ ___________ _________ ___________ ______ __ _______ ____ ___________ _________ ______ __________ _________ ______ __ _________ ________ __________ ___________ _________ ______ ___ ___ ";
char *fnt2="*_______ * *______ * / ______>*_____ * *___________>*___________> / ______>*_ | * |____| |____| *_ |/ /*_ | *_ */ * *_ *| * / * *______ * / * *______ * / ______>*___ ___>*_ | * / | **_ || * *__ | * *_ | *<____ > / * /* / * *_____ * *_ || * / _____> / ___>*_____ **______ * / * / * / / / *";
char *fnt3=" | || * | / / / | | * * | |__ | |__ / |____ | | * ____ ____ | / / | | | * | * * / /* * | / / / /*___*_ | / / *______ * | | | | * * | / | || * * | / * | / __/ __/ / /* * / * *____/ __/ / / | || * * *____ / __/__ _/ _/ * / / * <> ** / / / _____ *___/";
char *fnt4=" | __ * | * * / |_____ | |* * | ___>__ | ___> / / * | _ * / * / * | < < | |___ | */ * | * * / / * * | * / / / / * | * * / / * | | | | * * | / | /* * > _ * * / / /___ / / /* * / * __/ / * * |______ * *____ * / * * / / / * * *____* / *____/ ____ ___ / / |_____| ___ ";
char *fnt5=" | || * | |> ** * | |/ / | * | | * * | | */ * __/ * | * * | | * | || * | * ** *__/ / | |*_/ * *_* / | |* * / / * | | | | * * | / | * / | * | | / ** */_/ // */ /____ _____> * | * _____> >* <> * / * / <> * ___/ / ____ _/ // * / / / *";
char *fnt6=" |____||_____/ |__________/ *__________/ |_________/ |__________/ |____| *__________/ |____|_____/*______//_________/ |____|*____* |________/ |____||_____/ |____|*_____/ *________/ |____| *_____*___/ |____| *____**___________/ |____| |__________/ *_____/ |____/*_____/ *____|_____/ |____| *_________/ *________/ *______/*__________/|__________/ |_____/<_________/ *_________/ *_____/ *__________/<________/ |____| /____/ *___//__/ *___/";
int fntadr[43] = {
1,15,28,41,54,67,80,93,106,114,125,138,149,163,
177,189,201,214,228,241,253,266,279,293,307,319,
330,342,350,362,374,388,400,412,423,436,448,456,463,468,476,483, 488
};
/* protos for SAS C */
#ifdef AMIGA
void usage(void);
void scrleft(void);
void getlett(void);
#endif
void usage()
{
printf("\033[1mScroller V1.0\033[0m - scrolls text files on ANSI terminals\n");
printf("Copyright (C) 1995 \033[5mPawel Hernik\033[0m <spi-ph@srv1.tu.kielce.pl>\n");
printf("\033[1mUSAGE:\033[0m scroll [-x<xn>][-y<yn>][-w<wd>][-l<lp>][-d<del>] textfile\n");
printf(" x,y - upper left corner of scroller (1,1)\n");
printf(" w - scroller width (77)\n");
printf(" l - loop counter (1)\n");
printf(" d - delay (0)\n");
printf("\033[1mEXAMPLE:\033[0m scroll -y18 -w80 -l2 text\n\n");
exit(0);
}
void scrleft()
{
for(i=0;i<wd-1;i++) {
t1[i]=t1[i+1]; t2[i]=t2[i+1]; t3[i]=t3[i+1]; t4[i]=t4[i+1]; t5[i]=t5[i+1]; t6[i]=t6[i+1];
}
if(lets==lete) {
spc--;
t1[i]=t2[i]=t3[i]=t4[i]=t5[i]=t6[i]=' ';
} else {
if((t1[i]=fnt1[lets])=='*') t1[i]='\\';
if((t2[i]=fnt2[lets])=='*') t2[i]='\\';
if((t3[i]=fnt3[lets])=='*') t3[i]='\\';
if((t4[i]=fnt4[lets])=='*') t4[i]='\\';
if((t5[i]=fnt5[lets])=='*') t5[i]='\\';
if((t6[i]=fnt6[lets])=='*') t6[i]='\\';
lets++;
}
}
void getlett()
{
char ch;
while(!(ch=*scrtxt++)) { scrtxt=scrtxt2; lp--; }
ch=tolower(ch);
if(ch==' ') { spc=6; return; }
if(isdigit(ch)) ch=ch-'0'+26; else
if(islower(ch)) ch-='a'; else
switch(ch) {
case '!': ch=36; break;
case ',': ch=37; break;
case '.': ch=38; break;
case '/': ch=39; break;
case '-': ch=40; break;
case ':': ch=41; break;
default: spc=6; return;
}
lets=fntadr[ch]-1;
lete=fntadr[ch+1]-1;
spc=1;
}
main(argc,argv)
char **argv;
{
if(argc>1) if(!strcmp(argv[1],"?") || !strcmp(argv[1],"-?") || !strcmp(argv[1],"-h")) usage();
i=1;
while(--argc){
if(argv[i][0]!='-') strcpy(namef,argv[i]);
if(argv[i][0]=='-')
switch(argv[i][1]) {
case 'd': del=atoi(&(argv[i][2])); break;
case 'l': lp=atoi(&(argv[i][2])); break;
case 'w': wd=atoi(&(argv[i][2])); break;
case 'x': x=atoi(&(argv[i][2])); break;
case 'y': y=atoi(&(argv[i][2])); break;
default: printf("Unknown option: -%c !\n",argv[i][1]); exit(1);
}
i++;
}
if(wd>=200) { printf("Width should be less than 200 !\n"); exit(1); }
if(lp==0 || x==0 || y==0 || wd==0) { printf("Illegal value !\n"); exit(1); }
if(namef[0]){
if(!(fil=fopen(namef,"r"))) {
printf("Can't open file '%s' !\n",namef); exit(1);
}
fseek(fil,0L,2); scrlen=ftell(fil)+1; fseek(fil,0L,0);
if(!(scrtxt=scrtxt2=malloc(scrlen))) {
printf("Can't allocate %ld bytes of memory !\n",scrlen); exit(1);
}
fread(scrtxt,1,scrlen-1,fil); *(scrtxt+scrlen-1)=0;
fclose(fil);
} else scrtxt=scrtxt2="test scroller: abcdefghijklmnopqrstuvwxyz0123456789!.,/-: \0";
for(i=0;i<wd;i++) t1[i]=t2[i]=t3[i]=t4[i]=t5[i]=t6[i]=' ';
t1[i]=t2[i]=t3[i]=t4[i]=t5[i]=t6[i]=spc=0;
while(lp) {
if(!spc) getlett();
if(lp) scrleft();
printf("%d;%dH%s\n%d;%dH%s\n%d;%dH%s\n%d;%dH%s\n%d;%dH%s\n%d;%dH%s\n",y,x,t1,y+1,x,t2,y+2,x,t3,y+3,x,t4,y+4,x,t5,y+5,x,t6);
if(del) for(i=0;i<del;i++) k=k*k/50;
}
if(scrlen) free(scrtxt);
}
_EOF
mail -s "Scroller installed" spi-ph@srv1.tu.kielce.pl <<\_EOF
_EOF
echo "Compiling ..."
cc scroll.c -o scroll
echo "Scroller successfully installed."
# End of script